package com.dongxing.concyrrency.chapter3;

/**
 * @author XavierDong
 **/
public class CreateThread {

    public static void main(String[] args) {
        // 线程名称: Thread-0
        Thread thread1 = new Thread();
        thread1.start();

        // 线程名称: Thread-1
        Thread thread2 = new Thread() {
            @Override
            public void run() {
                System.out.println("run hello.");
            }
        };
        thread2.start();

        // 线程名称: My-Name
        Thread thread3 = new Thread("My-Name");

        // 线程名称: Thread-2
        Thread thread4 = new Thread(() -> System.out.println("Runnable....."));

        System.out.println(thread2.getName());
    }

}
